package com.design.patterns.responsibility;

/**
 * @Author: jinxuan
 * @Date: 2021/3/1 18:08
 */
public class Test {
    public static void main(String[] args) {
        //============组装任务============//
        Task task = new Task();
        task.setName("请假任务");
        task.setCause("回老家结婚");
        task.setApplyDays("10天");
        task.setType("年假");
        //============组装责任链============//
        CauseHandler causeHandler = new CauseHandler();
        ApplyDaysHandler applyDaysHandler = new ApplyDaysHandler();
        DaysHandler daysHandler = new DaysHandler();
        daysHandler.setNextTaskHandler(applyDaysHandler);
        applyDaysHandler.setNextTaskHandler(causeHandler);

        //============调用申请方法============//
        daysHandler.apply(task);

    }

}
